﻿<baseview:BaseView x:Class="CharacterCreation.Views.CharacterNewSkillsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:CharacterCreation.Controls"
    xmlns:baseview="clr-namespace:CharacterCreation.Views.Contracts"             
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
            <Button Command="{Binding AddCommand}" ToolTip="Add skill" Style="{StaticResource actionButton}">
                <Image Height="26" Source="/Images/ctron_add_26.png" VerticalAlignment="Center" />
            </Button>
            <Button Command="{Binding DeleteCommand}" ToolTip="Remove skill" Style="{StaticResource actionButton}">
                <Image Height="26" Source="/Images/ctron_delete_26.png" VerticalAlignment="Center" />
            </Button>
        </StackPanel>

        <controls:ListBox ItemsSource="{Binding Character.Skills}" SelectedItem="{Binding SelectedCharacterSkill, Mode=TwoWay}" Background="Transparent" Grid.Row="1">
            <controls:ListBox.CustomItemTemplate>
                <DataTemplate>
                    <DataTemplate.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="VerticalAlignment" Value="Center" />
                        </Style>
                        <Style TargetType="TextBox">
                            <Setter Property="TextAlignment" Value="Center" />
                        </Style>
                    </DataTemplate.Resources>

                    <Border Background="AliceBlue" BorderBrush="LightGray" BorderThickness="1" CornerRadius="3" Margin="1">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Width="40" Text="{Binding XP, StringFormat=XP: {0}}" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            <TextBlock Text="{Binding Skill.Name}" Margin="5" Foreground="{StaticResource backgroundBrush}" FontWeight="Bold"/>
                            <TextBlock Text="{Binding Score, StringFormat=lvl: {0}}" Margin="5" Foreground="{StaticResource backgroundBrush}" FontWeight="Bold" />
                            <TextBlock Text="{Binding RacialXP, StringFormat=RXP: {0}}" Margin="5" Foreground="Black"/>
                            <TextBlock Text="{Binding ProfessionalXP, StringFormat=PXP: {0}}" Margin="5" Foreground="Black"/>
                            <TextBlock Text="{Binding MiscellaneousXP, StringFormat=MiscXP: {0}}" Margin="5" Foreground="Black"/>
                            <TextBlock Text="{Binding TotalXP, StringFormat=TotalXP: {0}}" Margin="5" Foreground="Black"/>
                            <TextBlock Text="{Binding TotalBonus, StringFormat=Bonus: +{0}}" Margin="5" Foreground="Black"/>
                            <TextBlock Text="{Binding BoughtFrom, StringFormat=BF: {0}}" Margin="5" Foreground="Black"/>
                            <TextBlock Text="{Binding BoughtXP, StringFormat=BXP: {0}}" Margin="5" Foreground="Black"/>
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </controls:ListBox.CustomItemTemplate>

            <controls:ListBox.SelectedItemTemplate>
                <DataTemplate>
                    <DataTemplate.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="VerticalAlignment" Value="Center" />
                        </Style>
                        <Style TargetType="TextBox">
                            <Setter Property="TextAlignment" Value="Center" />
                        </Style>
                    </DataTemplate.Resources>
                    <Border Background="AliceBlue" BorderBrush="#DCADB9CD" BorderThickness="1" CornerRadius="3" Margin="1">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Skill.Name}" Margin="5" Foreground="{StaticResource backgroundBrush}" FontWeight="Bold" FontSize="15"/>
                                <TextBlock Text="{Binding Score, StringFormat=Totaal: {0}}" Margin="5" Foreground="Black"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Bought From: " Margin="5" Foreground="Black"/>
                                <TextBox Text="{Binding BoughtFrom, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="100"/>
                                <TextBlock Text="Bought XP: " Margin="5" Foreground="Black"/>
                                <TextBox Text="{Binding BoughtXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="40"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Race XP: " Margin="5" Foreground="Black"/>
                                <TextBox Text="{Binding RacialXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="40"/>
                                <TextBlock Text="Professional XP: " Margin="5" Foreground="Black"/>
                                <TextBox Text="{Binding ProfessionalXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="40"/>
                                <TextBlock Text="Miscellaneous XP: " Margin="5" Foreground="Black"/>
                                <TextBox Text="{Binding MiscellaneousXP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="40"/>
                                <TextBlock Text="XP: " Margin="5" Foreground="Black" />
                                <TextBox Text="{Binding XP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="40"/>
                                <TextBlock Text="{Binding TotalXP, StringFormat=TotalXP: {0}}" Margin="5" Foreground="Black"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="TotalBonus: " Margin="5" Foreground="Black"/>
                                <TextBox Text="{Binding TotalBonus, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" Foreground="Black" MinWidth="40"/>
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </controls:ListBox.SelectedItemTemplate>
        </controls:ListBox>
    </Grid>
</baseview:BaseView>
